home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / man / oldman3 / Regexp.3T < prev    next >
Text File  |  1992-06-26  |  5KB  |  133 lines

  1. .TH REGEXP
  2. .SH NAME
  3. Regexp  Regular expression pattern matching
  4. .SH SYNOPSIS
  5.  #include 
  6. <cool/Regexp.h>
  7. .SH DESCRIPTION
  8. A regular expression allows a programmer to specify complex patterns that can 
  9. be searched for and matched against the character string of a string object. In 
  10. its simplest form, a regular expression is a sequence of characters used to 
  11. search for exact character matches. However, many times the exact sequence to 
  12. be found is not known, or only a match at the beginning or end of a string is 
  13. desired. The cool regular expression class implements regular expression 
  14. pattern matching as is found and implemented in many UNIX commands and 
  15. utilities.
  16. .PP
  17. The regular expression class provides a convenient mechanism for specifying and 
  18. manipulating regular expressions. The regular expression object allows 
  19. specification of such patterns by using the following regular expression 
  20. metacharacters:
  21. .TP 10
  22.  ^
  23. Matches at beginning of a line
  24. .TP 10
  25.  $
  26. Matches at end of a line
  27. .TP 10
  28. \|.
  29. Matches any single character
  30. .TP 10
  31. [ ]
  32. Matches any character(s) inside the brackets
  33. .TP 10
  34. [^ ]
  35. Matches any character(s) \f2not\f1 inside the brackets
  36. .TP 10
  37.  \-
  38. Matches any character in range on either side of a dash
  39. .TP 10
  40.  *
  41. Matches preceding pattern zero or more times
  42. .TP 10
  43. +
  44. Matches preceding pattern one or more times
  45. .TP 10
  46.  ?
  47. Matches preceding pattern zero or once only
  48. .TP 10
  49. ()
  50. Saves a matched expression and uses it in a later match
  51. .PP
  52. Note that more than one of these metacharacters can be used in a single regular 
  53. expression in order to create complex search patterns. For example, the pattern 
  54. [^ab1-9] says to match any character sequence that does not begin with the 
  55. characters "ab" followed by numbers in the series one through nine.
  56. .SH Base Classes
  57.  
  58. .SH Friend Classes
  59. None
  60. .SH Constructors
  61. .TP
  62.  inline Regexp ();
  63. Creates an empty regular expression object with no private data initialized.
  64. .TP 
  65. \f3inline Regexp (char* \f2str\f3);\f1
  66. Creates a regular expression object and initializes all the data by compiling 
  67. the regular expression provided \f2str\f1. If an invalid regular expression is 
  68. detected, an \f3\f3Error\f1\f1 exception is raised.
  69. .TP
  70. \f3Regexp (const Regexp& \f2reg\f3);\f1
  71. Creates a regular expression object and duplicates the values and regular 
  72. expression of another regular expression object 
  73.  reg .
  74.  
  75. .SH Member Functions
  76. .TP
  77. \f3void compile (char* \f2str\f3);\f1
  78. Creates a compiled version of the argument \f2str\f1 and places it in the private 
  79. data. If an invalid expression is detected, an \f3\f3Error\f1\f1 exception is raised.
  80. .TP
  81. \f3Boolean deep_equal (const Regexp& \f2reg\f3) const;\f1
  82. Determines if two regular expressions are the same, including the zero-relative 
  83. start and end indexes of the last successful pattern match. This function 
  84. returns \f3TRUE\f1 if the expressions are the same; otherwise, this function returns 
  85. \f3FALSE\f1.
  86. .TP
  87.  inline long end () const;
  88. Returns an index into the last character string successfully searched for by 
  89. this object. The index corresponds to the character after the last item found. 
  90. If none are found, its value is
  91.  
  92.  NULL .
  93. .TP
  94. \f3Boolean find (char* \f2str\f3);\f1
  95. Searches for the already specified regular expression in 
  96.  str . 
  97. If the expression 
  98. is found, this function returns \f3TRUE\f1 and sets start and end indexes appropriately. If an invalid expression is detected, an \f3\f3Error\f1\f1 exception is 
  99. raised.
  100. .TP
  101.  inline Boolean is_valid () const;
  102. Returns \f3TRUE\f1 if a valid regular expression is compiled and ready for use; otherwise, this function returns \f3FALSE\f1.
  103. .TP
  104. \f3Boolean operator== (const Regexp& \f2reg\f3) const;\f1
  105. Determines if two regular expression objects are the same. This function 
  106. returns \f3TRUE\f1 if the expression objects are the same; otherwise, this function 
  107. returns \f3FALSE\f1.
  108. .TP
  109. \f3inline Boolean operator!= (const Regexp& \f2reg\f3) const;\f1
  110. Determines if two regular expression objects are not the same. This function 
  111. returns \f3TRUE\f1 if the expression objects are different; otherwise, this function 
  112. returns \f3FALSE\f1.
  113. .TP
  114.  inline void set_invalid ();
  115. Invalidates the current regular expression of the regular expression object.
  116. .TP
  117.  inline long start () const;
  118. Returns an index into the last character string successfully searched for by 
  119. this object. The index corresponds to the beginning of the last item found.  If 
  120. none are found, its value is \f3NULL\f1.
  121. .SH COPYRIGHT
  122.  
  123. Copyright (C) 1991 Texas Instruments Incorporated.
  124.  
  125. Permission is granted to any individual or institution to use, copy, modify,
  126. and distribute this software, provided that this complete copyright and
  127. permission notice is maintained, intact, in all copies and supporting
  128. documentation.
  129.  
  130. Texas Instruments Incorporated provides this software "as is" without
  131. express or implied warranty.
  132.  
  133.